package com.rimi.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rimi.bean.BookBean;
import com.rimi.bean.PageBean;
import com.rimi.dao.BookDao;
import com.rimi.service.BookService;

@Service
public class BookServiceImpl implements BookService {
	@Autowired
	private BookDao bd;

	@Override
	public List getBookAllInfo(BookBean bb) {
		return bd.getBookAllInfo(bb);
	}

	@Override
	public List getBookInfo(BookBean bb, PageBean pb) {
		Map map = new HashMap();
		map.put("bb", bb);
		map.put("pb", pb);
		// 在这里底层因为传入的是两个bean,所以必须封装成map才能传入,传入后spring会自动提取属性
		return bd.getBookInfo(map);
	}

	@Override
	public boolean addBook(BookBean bb) {
		if(bd.addBook(bb)==1) {
			
			return true;
		}else {
			return false;
		}
				
	}

	@Override
	public BookBean getBookByCode(String bookCode) {
		return bd.getBookByCode(bookCode);
		 
	}

	@Override
	public Integer delBook(String[] str) {
		
		return bd.delBook(str);
	}

	@Override
	public List toExcel(String[] str) {
		// TODO Auto-generated method stub
		return bd.toExcel(str);
	}
	
	

}
